home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 2 / AACD 2.iso / AACD / Programming / fpc / compiler / ag68kmit.pas < prev    next >
Pascal/Delphi Source File  |  1998-09-24  |  26KB  |  638 lines

  1. {
  2.     $Id: ag68kmit.pas,v 1.1.1.1.2.4 1998/09/14 18:55:48 carl Exp $
  3.     Copyright (c) 1998 by the FPC development team
  4.  
  5.     This unit implements an asmoutput class for MIT syntax with
  6.     Motorola 68000 (for MIT syntax TEST WITH GAS v1.34)
  7.  
  8.     This program is free software; you can redistribute it and/or modify
  9.     it under the terms of the GNU General Public License as published by
  10.     the Free Software Foundation; either version 2 of the License, or
  11.     (at your option) any later version.
  12.  
  13.     This program is distributed in the hope that it will be useful,
  14.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.     GNU General Public License for more details.
  17.  
  18.     You should have received a copy of the GNU General Public License
  19.     along with this program; if not, write to the Free Software
  20.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  
  22.  ****************************************************************************
  23.  
  24.   What's to do:
  25.     o Verify if this actually work as indirect mode with name of variables
  26.     o write lines numbers and file names to output file
  27.     o generate debugging informations
  28. }
  29.  
  30. unit ag68kmit;
  31.  
  32.     interface
  33.  
  34.     uses aasm,assemble;
  35.  
  36.     type
  37.       pm68kmitasmlist=^tm68kmitasmlist;
  38.       tm68kmitasmlist = object(tasmlist)
  39.         procedure WriteTree(p:paasmoutput);virtual;
  40.         procedure WriteAsmList;virtual;
  41.       end;
  42.  
  43.    implementation
  44.  
  45.     uses
  46.       dos,globals,systems,cobjects,m68k,
  47.       strings,files,verbose
  48. {$ifdef GDB}
  49.       ,gdb
  50. {$endif GDB}
  51.       ;
  52.  
  53.     const
  54.       line_length = 70;
  55.  
  56.     var
  57.       infile : pextfile;
  58.       includecount,lastline : longint;
  59.  
  60.     function getreferencestring(const ref : treference) : string;
  61.       var
  62.          s : string;
  63.       begin
  64.          s:='';
  65.          if ref.isintvalue then
  66.              s:='#'+tostr(ref.offset)
  67.          else
  68.            with ref do
  69.              begin
  70.                   { symbol and offset }
  71.                   if (assigned(symbol)) and (offset<>0) then
  72.                     Begin
  73.                       s:=s+'('+tostr(offset)+symbol^;
  74.                     end
  75.                   else
  76.                   { symbol only }
  77.                   if (assigned(symbol)) and (offset=0) then
  78.                     Begin
  79.                       s:=s+'('+symbol^;
  80.                     end
  81.                   else
  82.                   { offset only }
  83.                   if (symbol=nil) and (offset<>0) then
  84.                     Begin
  85.                       s:=s+'('+tostr(offset);
  86.                     end
  87.                   else
  88.                   { NOTHING - put zero as offset }
  89.                   if (symbol=nil) and (offset=0) then
  90.                     Begin
  91.                       s:=s+'('+'0';
  92.                     end
  93.                   else
  94.                    InternalError(10004);
  95.                   if (index<>R_NO) and (base=R_NO) and (direction=dir_none) then
  96.                    InternalError(10004)
  97.                 else if (index=R_NO) and (base<>R_NO) and (direction=dir_inc) then
  98.                 begin
  99.                   if (scalefactor = 1) or (scalefactor = 0) then
  100.                     Begin
  101.                       if offset<>0 then
  102.                         s:=mit_reg2str[base]+'@+'+s+')'
  103.                       else
  104.                         s:=mit_reg2str[base]+'@+';
  105.                     end
  106.                   else
  107.                    InternalError(10002);
  108.                 end
  109.                 else if (index=R_NO) and (base<>R_NO) and (direction=dir_dec) then
  110.                 begin
  111.                   if (scalefactor = 1) or (scalefactor = 0) then
  112.                     Begin
  113.                       if offset<>0 then
  114.                          s:=mit_reg2str[base]+'@-'+s+')'
  115.                       else
  116.                          s:=mit_reg2str[base]+'@-';
  117.                     end
  118.                   else
  119.                    InternalError(10003);
  120.                 end
  121.               else if (index=R_NO) and (base<>R_NO) and (direction=dir_none) then
  122.                 begin
  123.                   if (offset=0) and (symbol=nil) then
  124.                      s:=mit_reg2str[base]+'@'
  125.                   else
  126.                      s:=mit_reg2str[base]+'@'+s+')';
  127.                 end
  128.               else if (index<>R_NO) and (base<>R_NO) and (direction=dir_none) then
  129.                 begin
  130.                   s:=mit_reg2str[base]+'@'+s+','+mit_reg2str[index]+':L';
  131.                   if (scalefactor = 1) or (scalefactor = 0) then
  132.                       s:=s+')'
  133.                   else
  134.                      s:=s+':'+tostr(scalefactor)+')';
  135.                 end
  136.                 else
  137.                 if assigned(symbol) then
  138.                 Begin
  139.                    s:=symbol^;
  140.                    if offset<>0 then
  141.                      s:=s+'+'+tostr(offset);
  142.                 end
  143.                 { this must be a physical address }
  144.                 else
  145.                   s:=s+')';
  146. {                else if NOT assigned(symbol) then
  147.                   InternalError(10004);}
  148.             end; { end with }
  149.          getreferencestring:=s;
  150.       end;
  151.  
  152.  
  153.     function getopstr(t : byte;o : pointer) : string;
  154.       var
  155.          hs : string;
  156.          i: tregister;
  157.       begin
  158.          case t of
  159.             top_reg : getopstr:=mit_reg2str[tregister(o)];
  160.                top_ref : getopstr:=getreferencestring(preference(o)^);
  161.          top_reglist: begin
  162.                       hs:='';
  163.                       for i:=R_NO to R_FPSR do
  164.                       begin
  165.                         if i in tregisterlist(o^) then
  166.                          hs:=hs+mit_reg2str[i]+'/';
  167.                       end;
  168.                       delete(hs,length(hs),1);
  169.                       getopstr := hs;
  170.                     end;
  171.              top_const : getopstr:='#'+tostr(longint(o));
  172.             top_symbol :
  173.                     { compare with i386, where a symbol is considered }
  174.                     { a constant.                                     }
  175.                     begin
  176.                      hs[0]:=chr(strlen(pchar(pcsymbol(o)^.symbol)));
  177.                             move(pchar(pcsymbol(o)^.symbol)^,hs[1],byte(hs[0]));
  178. {                           inc(byte(hs[0]));}
  179.                             if pcsymbol(o)^.offset>0 then
  180.                               hs:=hs+'+'+tostr(pcsymbol(o)^.offset)
  181.                             else if pcsymbol(o)^.offset<0 then
  182.                               hs:=hs+tostr(pcsymbol(o)^.offset);
  183.                             getopstr:=hs;
  184.                          end;
  185.             else internalerror(10001);
  186.          end;
  187.       end;
  188.  
  189.  
  190.     function getopstr_jmp(t : byte;o : pointer) : string;
  191.       var
  192.          hs : string;
  193.       begin
  194.          case t of
  195.             top_reg : getopstr_jmp:=mit_reg2str[tregister(o)];
  196.             top_ref : getopstr_jmp:=getreferencestring(preference(o)^);
  197.             top_const : getopstr_jmp:=tostr(longint(o));
  198.             top_symbol : begin
  199.                             hs[0]:=chr(strlen(pchar(pcsymbol(o)^.symbol)));
  200.                             move(pchar(pcsymbol(o)^.symbol)^,hs[1],byte(hs[0]));
  201.                             if pcsymbol(o)^.offset>0 then
  202.                               hs:=hs+'+'+tostr(pcsymbol(o)^.offset)
  203.                             else if pcsymbol(o)^.offset<0 then
  204.                               hs:=hs+tostr(pcsymbol(o)^.offset);
  205.                             getopstr_jmp:=hs;
  206.                          end;
  207.             else internalerror(10001);
  208.          end;
  209.       end;
  210.  
  211.  
  212. {****************************************************************************
  213.                              T68kGASASMOUTPUT
  214.  ****************************************************************************}
  215.  
  216.     var
  217.        { different types of source lines }
  218.        n_line : byte;
  219.  
  220.     const
  221.       ait_const2str:array[ait_const_32bit..ait_const_8bit] of string[8]=
  222.         (#9'.long'#9,'',#9'.short'#9,#9'.byte'#9);
  223.  
  224.     procedure tm68kmitasmlist.WriteTree(p:paasmoutput);
  225.     var
  226.       hp        : pai;
  227.       ch        : char;
  228.       consttyp  : tait;
  229.       s         : string;
  230.       pos,l,i   : longint;
  231.       found     : boolean;
  232. {$ifdef GDB}
  233.       funcname  : pchar;
  234.       linecount : longint;
  235. {$endif GDB}
  236.     begin
  237. {$ifdef GDB}
  238.       funcname:=nil;
  239.       linecount:=1;
  240. {$endif GDB}
  241.       hp:=pai(p^.first);
  242.       while assigned(hp) do
  243.        begin
  244.        { write debugger informations }
  245. {$ifdef GDB}
  246.          if cs_debuginfo in aktswitches then
  247.           begin
  248.             if not (hp^.typ in  [ait_external,ait_stabn,ait_stabs,ait_stab_function_name]) then
  249.              begin
  250.                if assigned(hp^.infile) and (pextfile(hp^.infile)<>infile)  then
  251.                 begin
  252.                   infile:=hp^.infile;
  253.                   inc(includecount);
  254.                   if (hp^.infile^.path^<>'') then
  255.                    begin
  256.                      AsmWriteLn(#9'.stabs "'+FixPath(hp^.infile^.path^)+'",'+tostr(n_includefile)+
  257.                                 ',0,0,Ltext'+ToStr(IncludeCount));
  258.                    end;
  259.                   AsmWriteLn(#9'.stabs "'+FixFileName(hp^.infile^.name^+hp^.infile^.ext^)+'",'+tostr(n_includefile)+
  260.                              ',0,0,Ltext'+ToStr(IncludeCount));
  261.                   AsmWriteLn('Ltext'+ToStr(IncludeCount)+':');
  262.                 end;
  263.               { file name must be there before line number ! }
  264.                if (hp^.line<>lastline) and (hp^.line<>0) then
  265.                 begin
  266.                   if (n_line = n_textline) and assigned(funcname) and
  267.                      (target_info.use_function_relative_addresses) then
  268.                    begin
  269.                      AsmWriteLn(target_info.labelprefix+'l'+tostr(linecount)+':');
  270.                      AsmWriteLn(#9'.stabn '+tostr(n_line)+',0,'+tostr(hp^.line)+','+
  271.                                 target_info.labelprefix+'l'+tostr(linecount)+' - '+StrPas(FuncName));
  272.                      inc(linecount);
  273.                    end
  274.                   else
  275.                    AsmWriteLn(#9'.stabd'#9+tostr(n_line)+',0,'+tostr(hp^.line));
  276.                   lastline:=hp^.line;
  277.                 end;
  278.              end;
  279.           end;
  280. {$endif GDB}
  281.          case hp^.typ of
  282.        ait_comment,
  283.       ait_external : ; { external is ignored }
  284.          ait_align : AsmWriteLn(#9'.align '+tostr(pai_align(hp)^.aligntype));
  285.      ait_datablock : begin
  286.                        { ------------------------------------------------------- }
  287.                        { ----------- ALIGNMENT FOR ANY NON-BYTE VALUE ---------- }
  288.                        { ------------- REQUIREMENT FOR 680x0 ------------------- }
  289.                        { ------------------------------------------------------- }
  290.                        if pai_datablock(hp)^.size <> 1 then
  291.                         begin
  292.                           if not(cs_littlesize in aktswitches) then
  293.                            AsmWriteLn(#9#9'.align 4')
  294.                           else
  295.                            AsmWriteLn(#9#9'.align 2');
  296.                         end;
  297.                        if pai_datablock(hp)^.is_global then
  298.                         AsmWrite(#9'.comm'#9)
  299.                        else
  300.                         AsmWrite(#9'.lcomm'#9);
  301.                        AsmWriteLn(StrPas(pai_datablock(hp)^.name)+','+tostr(pai_datablock(hp)^.size));
  302.                      end;
  303.    ait_const_32bit, { alignment is required for 16/32 bit data! }
  304.    ait_const_16bit:  begin
  305.                        AsmWrite(ait_const2str[hp^.typ]+tostr(pai_const(hp)^.value));
  306.                        consttyp:=hp^.typ;
  307.                        l:=0;
  308.                        repeat
  309.                          found:=(not (Pai(hp^.next)=nil)) and (Pai(hp^.next)^.typ=consttyp);
  310.                          if found then
  311.                           begin
  312.                             hp:=Pai(hp^.next);
  313.                             s:=','+tostr(pai_const(hp)^.value);
  314.                             AsmWrite(s);
  315.                             inc(l,length(s));
  316.                           end;
  317.                        until (not found) or (l>line_length);
  318.                        AsmLn;
  319.                      end;
  320.     ait_const_8bit : begin
  321.                        AsmWrite(ait_const2str[hp^.typ]+tostr(pai_const(hp)^.value));
  322.                        consttyp:=hp^.typ;
  323.                        l:=0;
  324.                        repeat
  325.                          found:=(not (Pai(hp^.next)=nil)) and (Pai(hp^.next)^.typ=consttyp);
  326.                          if found then
  327.                           begin
  328.                             hp:=Pai(hp^.next);
  329.                             s:=','+tostr(pai_const(hp)^.value);
  330.                             AsmWrite(s);
  331.                             inc(l,length(s));
  332.                           end;
  333.                        until (not found) or (l>line_length);
  334.                        AsmLn;
  335.                      end;
  336.   ait_const_symbol : Begin
  337.                        AsmWriteLn(#9'.long'#9+StrPas(pchar(pai_const(hp)^.value)));
  338.                      end;
  339.     ait_real_64bit : Begin
  340.                       AsmWriteLn(#9'.double'#9+double2str(pai_double(hp)^.value));
  341.                      end;
  342.     ait_real_32bit : Begin
  343.                       AsmWriteLn(#9'.single'#9+double2str(pai_single(hp)^.value));
  344.                      end;
  345.  ait_real_extended : Begin
  346.                       AsmWriteLn(#9'.extend'#9+double2str(pai_extended(hp)^.value));
  347.                      { comp type is difficult to write so use double }
  348.                      end;
  349.           ait_comp : Begin
  350.                        AsmWriteLn(#9'.double'#9+comp2str(pai_extended(hp)^.value));
  351.                      end;
  352.         ait_direct : begin
  353.                        AsmWritePChar(pai_direct(hp)^.str);
  354.                        AsmLn;
  355. {$IfDef GDB}
  356.                        if strpos(pai_direct(hp)^.str,'.data')<>nil then
  357.                          n_line:=n_dataline
  358.                        else if strpos(pai_direct(hp)^.str,'.text')<>nil then
  359.                          n_line:=n_textline
  360.                        else if strpos(pai_direct(hp)^.str,'.bss')<>nil then
  361.                          n_line:=n_bssline;
  362. {$endif GDB}
  363.                      end;
  364.         ait_string : begin
  365.                        pos:=0;
  366.                        for i:=1 to pai_string(hp)^.len do
  367.                         begin
  368.                           if pos=0 then
  369.                            begin
  370.                              AsmWrite(#9'.ascii'#9'"');
  371.                              pos:=20;
  372.                            end;
  373.                           ch:=pai_string(hp)^.str[i-1];
  374.                           case ch of
  375.                              #0, {This can't be done by range, because a bug in FPC}
  376.                         #1..#31,
  377.                         #48..#57,{ Bug with gas < 2.00 with reading octals followed by digits }
  378.                      #128..#255 : s:='\'+tostr(ord(ch) shr 6)+tostr((ord(ch) and 63) shr 3)+tostr(ord(ch) and 7);
  379.                             '"' : s:='\"';
  380.                             '\' : s:='\\';
  381.                           else
  382.                            s:=ch;
  383.                           end;
  384.                           AsmWrite(s);
  385.                           inc(pos,length(s));
  386.                           if (pos>line_length) or (i=pai_string(hp)^.len) then
  387.                            begin
  388.                              AsmWriteLn('"');
  389.                              pos:=0;
  390.                            end;
  391.                         end;
  392.                      end;
  393.          ait_label : begin
  394.                        if assigned(hp^.next) and (pai(hp^.next)^.typ in
  395.                           [ait_const_32bit,ait_const_16bit,ait_const_8bit,ait_const_symbol,
  396.                            ait_real_64bit,ait_real_32bit,ait_string]) then
  397.                         begin
  398.                           if not(cs_littlesize in aktswitches) then
  399.                            AsmWriteLn(#9#9'.align 4')
  400.                           else
  401.                            AsmWriteLn(#9#9'.align 2');
  402.                         end;
  403.                        if (pai_label(hp)^.l^.is_used) then
  404.                         AsmWriteLn(lab2str(pai_label(hp)^.l)+':');
  405.                      end;
  406. ait_labeled_instruction : begin
  407.                      { labeled operand }
  408.                        if pai_labeled(hp)^._op1 = R_NO then
  409.                         AsmWriteLn(#9+mot_op2str[pai_labeled(hp)^._operator]+#9+lab2str(pai_labeled(hp)^.lab))
  410.                        else
  411.                      { labeled operand with register }
  412.                         AsmWriteLn(#9+mot_op2str[pai_labeled(hp)^._operator]+#9+
  413.                                  reg2str(pai_labeled(hp)^._op1)+','+lab2str(pai_labeled(hp)^.lab))
  414.                      end;
  415.         ait_symbol : begin
  416.                        { ------------------------------------------------------- }
  417.                        { ----------- ALIGNMENT FOR ANY NON-BYTE VALUE ---------- }
  418.                        { ------------- REQUIREMENT FOR 680x0 ------------------- }
  419.                        { ------------------------------------------------------- }
  420.                        if assigned(hp^.next) and (pai(hp^.next)^.typ in
  421.                           [ait_const_32bit,ait_const_16bit,ait_const_8bit,ait_const_symbol,
  422.                            ait_real_64bit,ait_real_32bit,ait_string]) then
  423.                         begin
  424.                           if not(cs_littlesize in aktswitches) then
  425.                            AsmWriteLn(#9#9'.align 4')
  426.                           else
  427.                            AsmWriteLn(#9#9'.align 2');
  428.                         end;
  429.                        if pai_symbol(hp)^.is_global then
  430.                         AsmWriteLn('.globl '+StrPas(pai_symbol(hp)^.name));
  431.                        AsmWriteLn(StrPas(pai_symbol(hp)^.name)+':');
  432.                      end;
  433.    ait_instruction : begin
  434.                        { old versions of GAS don't like PEA.L and LEA.L }
  435.                        if (pai68k(hp)^._operator in [
  436.                             A_LEA,A_PEA,A_ABCD,A_BCHG,A_BCLR,A_BSET,A_BTST,
  437.                             A_EXG,A_NBCD,A_SBCD,A_SWAP,A_TAS,A_SCC,A_SCS,
  438.                             A_SEQ,A_SGE,A_SGT,A_SHI,A_SLE,A_SLS,A_SLT,A_SMI,
  439.                             A_SNE,A_SPL,A_ST,A_SVC,A_SVS,A_SF]) then
  440.                         s:=#9+mot_op2str[pai68k(hp)^._operator]
  441.                        else
  442.                         s:=#9+mot_op2str[pai68k(hp)^._operator]+mit_opsize2str[pai68k(hp)^.size];
  443.                        if pai68k(hp)^.op1t<>top_none then
  444.                         begin
  445.                         { call and jmp need an extra handling                          }
  446.                         { this code is only callded if jmp isn't a labeled instruction }
  447.                           if pai68k(hp)^._operator in [A_JSR,A_JMP] then
  448.                            s:=s+#9+getopstr_jmp(pai68k(hp)^.op1t,pai68k(hp)^.op1)
  449.                           else
  450.                            if pai68k(hp)^.op1t = top_reglist then
  451.                             s:=s+#9+getopstr(pai68k(hp)^.op1t,@(pai68k(hp)^.reglist))
  452.                            else
  453.                             s:=s+#9+getopstr(pai68k(hp)^.op1t,pai68k(hp)^.op1);
  454.                            if pai68k(hp)^.op2t<>top_none then
  455.                             begin
  456.                               if pai68k(hp)^.op2t = top_reglist then
  457.                                s:=s+','+getopstr(pai68k(hp)^.op2t,@pai68k(hp)^.reglist)
  458.                               else
  459.                                s:=s+','+getopstr(pai68k(hp)^.op2t,pai68k(hp)^.op2);
  460.                             { three operands }
  461.                               if pai68k(hp)^.op3t<>top_none then
  462.                                begin
  463.                                    if (pai68k(hp)^._operator = A_DIVSL) or
  464.                                       (pai68k(hp)^._operator = A_DIVUL) or
  465.                                       (pai68k(hp)^._operator = A_MULU) or
  466.                                       (pai68k(hp)^._operator = A_MULS) or
  467.                                       (pai68k(hp)^._operator = A_DIVS) or
  468.                                       (pai68k(hp)^._operator = A_DIVU) then
  469.                                     s:=s+':'+getopstr(pai68k(hp)^.op3t,pai68k(hp)^.op3)
  470.                                    else
  471.                                     s:=s+','+getopstr(pai68k(hp)^.op3t,pai68k(hp)^.op3);
  472.                                end;
  473.                             end;
  474.                         end;
  475.                        AsmWriteLn(s);
  476.                      end;
  477. {$ifdef GDB}
  478.          ait_stabs : begin
  479.                        AsmWrite(#9'.stabs ');
  480.                        AsmWritePChar(pai_stabs(hp)^.str);
  481.                        AsmLn;
  482.                      end;
  483.          ait_stabn : begin
  484.                        AsmWrite(#9'.stabn ');
  485.                        AsmWritePChar(pai_stabn(hp)^.str);
  486.                        AsmLn;
  487.                      end;
  488. ait_stab_function_name : funcname:=pai_stab_function_name(hp)^.str;
  489. {$endif GDB}
  490.          else
  491.           internalerror(10000);
  492.          end;
  493.          hp:=pai(hp^.next);
  494.        end;
  495.     end;
  496.  
  497.     procedure tm68kmitasmlist.WriteAsmList;
  498. {$ifdef GDB}
  499.     var
  500.       p,n,e : string;
  501. {$endif}
  502.     begin
  503. {$ifdef EXTDEBUG}
  504.       if assigned(current_module^.mainsource) then
  505.        comment(v_info,'Start writing gas-styled assembler output for '+current_module^.mainsource^);
  506. {$endif}
  507.       infile:=nil;
  508.       includecount:=0;
  509. {$ifdef GDB}
  510.       if assigned(current_module^.mainsource) then
  511.        fsplit(current_module^.mainsource^,p,n,e)
  512.       else
  513.        begin
  514.          p:=inputdir;
  515.          n:=inputfile;
  516.          e:=inputextension;
  517.        end;
  518.     { to get symify to work }
  519.       AsmWriteLn(#9'.file "'+FixFileName(n+e)+'"');
  520.     { stabs }
  521.       n_line:=n_bssline;
  522.       if (cs_debuginfo in aktswitches) then
  523.        begin
  524.          if (p<>'') then
  525.           AsmWriteLn(#9'.stabs "'+FixPath(p)+'",'+tostr(n_sourcefile)+',0,0,Ltext0');
  526.          AsmWriteLn(#9'.stabs "'+FixFileName(n+e)+'",'+tostr(n_sourcefile)+',0,0,Ltext0');
  527.          AsmWriteLn('Ltext0:');
  528.        end;
  529.       infile:=current_module^.sourcefiles.files;
  530. {$endif GDB}
  531.  
  532.     { main source file is last in list }
  533.       while assigned(infile^._next) do
  534.        infile:=infile^._next;
  535.       lastline:=0;
  536.       { there should be nothing but externals so we don't need to process
  537.       WriteTree(externals); }
  538.       WriteTree(debuglist);
  539.  
  540.     { code segment }
  541.       AsmWriteln('.text');
  542. {$ifdef GDB}
  543.       n_line:=n_textline;
  544. {$endif GDB}
  545.       WriteTree(codesegment);
  546.  
  547.       AsmWriteLn('.data');
  548. {$ifdef EXTDEBUG}
  549.       AsmWriteLn(#9'.ascii'#9'"compiled by FPC '+version_string+'\0"');
  550.       AsmWriteLn(#9'.ascii'#9'"target: '+target_info.target_name+'\0"');
  551. {$endif EXTDEBUG}
  552. {$ifdef GDB}
  553.       n_line:=n_dataline;
  554. {$endif GDB}
  555.       DataSegment^.insert(new(pai_align,init(4)));
  556.       WriteTree(datasegment);
  557.       WriteTree(consts);
  558.  
  559.     { makes problems with old GNU ASes
  560.       AsmWriteLn('.bss');
  561.       bssSegment^.insert(new(pai_align,init(4))); }
  562. {$ifdef GDB}
  563.       n_line:=n_bssline;
  564. {$endif GDB}
  565.       WriteTree(bsssegment);
  566.  
  567.       AsmLn;
  568. {$ifdef EXTDEBUG}
  569.       if assigned(current_module^.mainsource) then
  570.        comment(v_info,'Done writing gas-styled assembler output for '+current_module^.mainsource^);
  571. {$endif EXTDEBUG}
  572.     end;
  573.  
  574. end.
  575. {
  576.   $Log: ag68kmit.pas,v $
  577.   Revision 1.1.1.1.2.4  1998/09/14 18:55:48  carl
  578.     * alignment bugfix for bytes
  579.  
  580.   Revision 1.1.1.1.2.3  1998/07/21 12:10:12  carl
  581.     * old MIT syntax does not like octal values by numeric digit strings
  582.  
  583.   Revision 1.1.1.1  1998/03/25 11:18:16  root
  584.   * Restored version
  585.  
  586.   Revision 1.3  1998/03/22 12:45:37  florian
  587.     * changes of Carl-Eric to m68k target commit:
  588.       - wrong nodes because of the new string cg in intel, I had to create
  589.         this under m68k also ... had to work it out to fix potential alignment
  590.         problems --> this removes the crash of the m68k compiler.
  591.       - added absolute addressing in m68k assembler (required for Amiga startup)
  592.       - fixed alignment problems (because of byte return values, alignment
  593.         would not be always valid) -- is this ok if i change the offset if odd in
  594.         setfirsttemp ?? -- it seems ok...
  595.  
  596.   Revision 1.2  1998/03/10 04:22:45  carl
  597.     - removed in because can cause range check errors in BP
  598.  
  599.   Revision 1.1  1998/03/10 01:26:10  peter
  600.     + new uniform names
  601.  
  602.   Revision 1.8  1998/03/09 12:58:11  peter
  603.     * FWait warning is only showed for Go32V2 and $E+
  604.     * opcode tables moved to i386.pas/m68k.pas to reduce circular uses (and
  605.       for m68k the same tables are removed)
  606.     + $E for i386
  607.  
  608.   Revision 1.7  1998/03/06 00:52:25  peter
  609.     * replaced all old messages from errore.msg, only ExtDebug and some
  610.       Comment() calls are left
  611.     * fixed options.pas
  612.  
  613.   Revision 1.6  1998/03/02 01:48:44  peter
  614.     * renamed target_DOS to target_GO32V1
  615.     + new verbose system, merged old errors and verbose units into one new
  616.       verbose.pas, so errors.pas is obsolete
  617.  
  618.   Revision 1.5  1998/02/23 02:53:52  carl
  619.     * some bugfix with $extdebug
  620.  
  621.   Revision 1.4  1998/02/22 23:03:19  peter
  622.     * renamed msource->mainsource and name->unitname
  623.     * optimized filename handling, filename is not seperate anymore with
  624.       path+name+ext, this saves stackspace and a lot of fsplit()'s
  625.     * recompiling of some units in libraries fixed
  626.     * shared libraries are working again
  627.     + $LINKLIB <lib> to support automatic linking to libraries
  628.     + libraries are saved/read from the ppufile, also allows more libraries
  629.       per ppufile
  630.  
  631.   Revision 1.3  1998/02/22 21:56:29  carl
  632.     * bugfix of offset with index
  633.  
  634.   Revision 1.2  1998/02/21 20:20:01  carl
  635.     * make it work under older versions of GAS
  636.  
  637. }
  638.